OpenRoads Designer CONNECT Edition SDK Help

Modify alignment properties

Once the alignment is created, user can still modify the alignment properties such as geometry, feature definition etc. The below code snippet shows how this can be achieved.

Example


internal void ChangeAlignmentProperties(Alignment alignment)
        {
            //Get active connection to dgn
            Bentley.CifNET.SDK.Edit.ConsensusConnectionEdit con = ConsensusConnectionEdit.GetActive();

            //start transient mode to save changes
            con.StartTransientMode();

            //Set new alignment name
            string newName = "SampleHorizontalAlignment";
            alignment.SetName(newName);

            //set new feature definition
            string featureDef = "Alignment\\Geom_Centerline";
            alignment.SetFeatureDefinition(featureDef);

            //change geometry
            Bentley.GeometryNET.DPoint3d curveStartPoint = new DPoint3d(10657.755, 10231.216);
            Bentley.GeometryNET.DPoint3d curveEndPoint = new DPoint3d(10712.728, 10223.799);

            double radius = 100;
            Bentley.CifNET.LinearGeometry.Hand direction = Hand.Clockwise;
            Bentley.CifNET.LinearGeometry.CircularArc arc = Bentley.CifNET.LinearGeometry.CircularArc.
Create4(curveStartPoint, curveEndPoint, radius, direction);
            LinearElement ele = arc;

            //Removes the existing geometry from alignment and sets the new 
            alignment.SetLinearGeometry(ele);

            //Add stationing to alignment
            alignment.AddStationing(arc.Length / 2, 10, true);

            //save changes to dgn
            con.PersistTransients();

            return;
        }